package cn.iocoder.yudao.module.moa.dal.mysql.expensecategory;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.moa.dal.dataobject.expensecategory.ExpenseCategoryDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.moa.controller.admin.expensecategory.vo.*;

/**
 * 费用类型 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ExpenseCategoryMapper extends BaseMapperX<ExpenseCategoryDO> {

    default PageResult<ExpenseCategoryDO> selectPage(ExpenseCategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ExpenseCategoryDO>()
                .eqIfPresent(ExpenseCategoryDO::getPid, reqVO.getPid())
                .eqIfPresent(ExpenseCategoryDO::getInnercode, reqVO.getInnercode())
                .eqIfPresent(ExpenseCategoryDO::getCode, reqVO.getCode())
                .likeIfPresent(ExpenseCategoryDO::getName, reqVO.getName())
                .eqIfPresent(ExpenseCategoryDO::getIsLeaf, reqVO.getIsLeaf())
                .betweenIfPresent(ExpenseCategoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ExpenseCategoryDO::getId));
    }

}